<?php
include 'db.php';

if (isset($_GET['id'])) {
    $id = $_GET['id'];

    $stmt = $pdo->prepare("SELECT result FROM call_records WHERE id = ?");
    $stmt->execute([$id]);
    $result = $stmt->fetch(PDO::FETCH_ASSOC);

    if ($result) {
        echo json_encode(['success' => true, 'result' => $result['result']]);
    } else {
        echo json_encode(['success' => false, 'message' => '调用记录未找到']);
    }
} else {
    echo json_encode(['success' => false, 'message' => 'Invalid request']);
}